using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace Wzh_CheckAB
{
    public static class PHExtension 
    {
        public static string ItemDataBase_ToString(this ItemDataBase itemData)
        {
            if (itemData == null) return "";
            string res = "";
            res = StringBuilderTool.Append("id:", itemData.id.ToString(), "\n");
            res = StringBuilderTool.Append(res, "name:", itemData.name, "\n");
            //res = StringBuilderTool.Append(res, "assetbundleDir:", itemData.assetbundleDir, "\n");
            res = StringBuilderTool.Append(res, "assetbundleName:", itemData.assetbundleName, "\n");
            //res = StringBuilderTool.Append(res, "name_LineFeed:", itemData.name_LineFeed, "\n");
            //res = StringBuilderTool.Append(res, "order:", itemData.order.ToString(), "\n");
            res = StringBuilderTool.Append(res, "Mlist:", Path.GetFileName(itemData.Mlist_path), "\n");
            return res;
        }

        public static string ItemDataBase_ABToString(this ItemDataBase itemData, List<ItemDataBase> itemdataList, string size)
        {
            if (itemData == null) return "";
            string res = "";
            res = StringBuilderTool.Append(res, "AB: ", itemData.assetbundleName, "\n");
            res = StringBuilderTool.Append(res, "Mlist: ", Path.GetFileName(itemData.Mlist_path), "\n");
            res = StringBuilderTool.Append(res, "Size: ", size, "\n");
            if (itemdataList != null)
            {
                res = StringBuilderTool.Append(res, "Count: ", itemdataList.Count.ToString(), "\n");
                string abBB = StringBuilderTool.Append("id: ", "            ", "name: ", "\n");
                foreach (var item in itemdataList)
                    abBB = StringBuilderTool.Append(abBB, item.id.ToString(), "     ", item.name, "\n");
                res = StringBuilderTool.Append(res, abBB);
            }
            return res;
        }
    }
}